package tpo.wmb.provider.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import pojo.Area;
import pojo.User;

import java.util.List;
import java.util.Map;

//用户
@Repository

public interface UserMapper {


    /**
     * 客户分页条件查询
     */
    List<User> selectUserList( Map<String,Object> map);


    /**
     * 所有客户查询
     */
    @Select("select * from user where deleteState = 1")
    List<User> selectUsers();


    /**
     * 用户名模糊查询
     * @param name
     * @return
     */
    List<Integer> selectUserListInt( String name);

    /**
     * 查看客户
     */
    @Select("select * from user where id = #{id}")
    User selectUser( Integer id);



    /**
     * 新增客户
     */
    Integer insertUser( User user);



    /**
     *修改客户
     */
    Integer updateUser( User user);


    /**
     * 删除客户
     */
    @Delete("update user set deleteState = 0 where id = #{id}")
    Integer deleteUser(Integer id);


    /**
     * 根据用户选择的区域查询对应的省份集合
     * @return
     */
    @Select("select * from area where upperLevelID = #{upperLevelID}")
    List<Area> selectUserArea(Integer upperLevelID);

}
